package com.example.zg.zg_312_ordering_new.model;

import com.example.zg.zg_312_ordering_new.activity.FoodInfoActivity;
import com.example.zg.zg_312_ordering_new.common.Constants;
import com.example.zg.zg_312_ordering_new.listener.RetrofitListener;
import com.example.zg.zg_312_ordering_new.services.FoodService;
import com.example.zg.zg_312_ordering_new.services.ShopService;

import retrofit2.Call;

public class FoodModel extends RetrofitBaseModel{
    private FoodService foodService;
    public FoodModel(){
        this.foodService=retrofit.create(FoodService.class);
    }


    public void getFoodByShop(int shop_id, RetrofitListener listener){
        Call call=foodService.getFoodByShop(shop_id);
        bindCallback(call,listener,Constants.GETFOODBYSHOP);
    }
    //判断是否收藏
    public void isCollected(int user_id,int shop_food_id,int flag,final RetrofitListener retrofitListener){
        Call call=foodService.isCollected(user_id,shop_food_id,flag);
        bindCallback(call,retrofitListener,Constants.ISCOLLECTED);
    }
    //收藏/取消收藏店铺
    public void userCollectShop(int user_id , int shop_id , final RetrofitListener retrofitListener){
        Call call = foodService.userCollectShop(user_id,shop_id);
        bindCallback(call,retrofitListener,Constants.USERCOLLECTFOOD);
    }
    //收藏/取消收藏菜品
    public void userCollectFood(String user_id , int food_id , final RetrofitListener retrofitListener){
        Call call = foodService.userColloctFood(user_id , food_id);
        bindCallback(call , retrofitListener , Constants.USERCOLLECTFOOD);
    }
    public void getFoodById(int food_id, RetrofitListener listener){
        Call call=foodService.getFoodById(food_id);
        bindCallback(call,listener,Constants.GETFOODBYID);
    }
//    public void getAllUserComment(String user_id,RetrofitListener listener){
//        Call call=foodService.getAllUserComment(user_id);
//        bindCallback(call,listener,Constants.GETALLUSERCOMMENT);
//    }

    public void getAllUserFoodOrder(int food_id, final RetrofitListener retrofitListener) {
        Call call=foodService.getAllUserComment(food_id);
        bindCallback(call,retrofitListener,Constants.GETALLUSERCOMMENT);
    }
}
